package mumethod;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import muobject.Student;
import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.data.JRAbstractBeanDataSourceProvider;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;

public class DataSourceBaseFactory extends JRAbstractBeanDataSourceProvider  {

	 public DataSourceBaseFactory() {
	       super(Student.class);
	    }
	 
	public JRDataSource create(JasperReport arg0) throws JRException {

		 List<Student> mainList = new ArrayList<Student>();

		try {
			for (int i = 0; i < 10; i++) {
				mainList.add(new Student(i, "A" + i, "A" + i, "A" + i,
						"A", i, "A" + i, "A" + i, "A" + i,
						null, "2011", "A" + i,null,
						null));
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			
		}
		
		return new JRBeanCollectionDataSource(mainList);
	}
	
	public void dispose(JRDataSource dataSource) throws JRException{
		
	}
}